home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / src / sprited / fs / fsStat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-18  |  23.4 KB  |  601 lines

  1. /*
  2.  * fsStat.h --
  3.  *
  4.  *    Declarations for the file system statistics.
  5.  *
  6.  *    Note: since all variables are counters, they are unsigned
  7.  *    in order to make the high-order bit useable.
  8.  *
  9.  * Copyright 1986 Regents of the University of California
  10.  * All rights reserved.
  11.  *
  12.  *
  13.  * $Header: /user5/kupfer/spriteserver/src/sprited/fs/RCS/fsStat.h,v 1.2 92/05/17 18:58:07 kupfer Exp $ SPRITE (Berkeley)
  14.  */
  15.  
  16. #ifndef _FSSTAT
  17. #define _FSSTAT
  18.  
  19. /*
  20.  * Note, both client and server Naming operations are kept.
  21.  */
  22. typedef struct Fs_NameOpStats {
  23.     unsigned int numReadOpens;        /* open(O_RDONLY) on client.  Count
  24.                      * of all server open calls */
  25.     unsigned int numWriteOpens;        /* open(O_WRONLY) */
  26.     unsigned int numReadWriteOpens;    /* open(O_RDWR) */
  27.     unsigned int chdirs;        /* Number Fs_ChangeDir */
  28.     unsigned int makeDevices;        /* Number Fs_MakeDevice */
  29.     unsigned int makeDirs;        /* Number Fs_MakeDirectory */
  30.     unsigned int removes;        /* Number Fs_Remove */
  31.     unsigned int removeDirs;        /* Number Fs_RemoveDirs */
  32.     unsigned int renames;        /* Number Fs_Rename */
  33.     unsigned int hardLinks;        /* Number Fs_HardLink */
  34.     unsigned int symLinks;        /* Number Fs_SymLink */
  35.     unsigned int getAttrs;        /* Number get attrs from name */
  36.     unsigned int setAttrs;        /* Number set attrs by name */
  37.     unsigned int getAttrIDs;        /* Number set attrs by open stream */
  38.     unsigned int setAttrIDs;        /* Number get attrs from open stream */
  39.     unsigned int getIOAttrs;        /* Number get attr from I/O server */
  40.     unsigned int setIOAttrs;        /* Number set attr to I/O server */
  41. } Fs_NameOpStats;
  42.  
  43. typedef struct Fs_GeneralStats {
  44.     unsigned int physBytesRead;        /* Number of physical (ie descriptors)
  45.                       * disk bytes read. */
  46.     unsigned int fileBytesRead;        /* Number of file bytes read from the
  47.                      * disk */
  48.     unsigned int fileReadOverflow;    /* Extra */
  49.     unsigned int remoteBytesRead;    /* Bytes read in Fsrmt_Read. */
  50.     unsigned int remoteReadOverflow;    /* Extra */
  51.     unsigned int deviceBytesRead;    /* Number of bytes read from devices */
  52.  
  53.     unsigned int physBytesWritten;    /* Number of physical disk bytes
  54.                      * written */
  55.     unsigned int fileBytesWritten;    /* Number of file bytes written to
  56.                      * the disk */
  57.     unsigned int fileWriteOverflow;    /* Extra */
  58.     unsigned int remoteBytesWritten;    /* Bytes written in Fsrmt_Write */
  59.     unsigned int remoteWriteOverflow;    /* Extra */
  60.     unsigned int deviceBytesWritten;    /* Number of bytes written to devices */
  61.     unsigned int fileBytesDeleted;    /* Number of file bytes deleted
  62.                      * (total) */
  63.     unsigned int fileDeleteOverflow;    /* Extra */
  64. } Fs_GeneralStats;
  65.  
  66. /*
  67.  * Cache statistics.
  68.  */
  69. typedef struct Fs_BlockCacheStats {
  70.     /*
  71.      * Read statistics.
  72.      */
  73.     unsigned int readAccesses;        /* Read fetches on the cache. */
  74.     unsigned int bytesRead;        /* Total bytes read from the cache
  75.                      * including misses read into cache */
  76.     unsigned int bytesReadOverflow;    /* Extra */
  77.     unsigned int readHitsOnDirtyBlock;    /* Fetches that hit on a block that had
  78.                       * dirty data in it. */
  79.     unsigned int readHitsOnCleanBlock;    /* Fetches that hit on a block that had
  80.                       * clean data in it. */
  81.     unsigned int readZeroFills;        /* Blocks that are zero filled
  82.                      * because read did not fill the
  83.                      * whole block. */
  84.     unsigned int domainReadFails;    /* Number of domain reads from
  85.                      * Fscache_Write and Fscache_Read that
  86.                      * were unsuccessful. */
  87.     unsigned int readAheads;        /* Number of read ahead processes
  88.                      * that were started up. */
  89.     unsigned int readAheadHits;        /* Number of reads that hit on a
  90.                      * block that was read ahead. */
  91.     unsigned int allInCacheCalls;    /* Number of time FscacheAllBlocksInCache routine
  92.                      * was called. */
  93.     unsigned int allInCacheTrue;        /* Number of times that FscacheAllBlocksInCache
  94.                      * returned TRUE. */
  95.     /*
  96.      * Write statistics.  See also WriteBackStats.
  97.      */
  98.     unsigned int writeAccesses;        /* Number of write fetches on the
  99.                      * cache. */
  100.     unsigned int bytesWritten;        /* Total bytes written to the cache
  101.                      * including new blocks */
  102.     unsigned int bytesWrittenOverflow;    /* Extra */
  103.     unsigned int appendWrites;        /* NEVER SET. Blocks written in 
  104.                      * append mode. */
  105.     unsigned int overWrites;        /* Cache blocks that were
  106.                      * overwritten. */
  107.     unsigned int writeZeroFills1;    /* Blocks that are zero filled because
  108.                      * read of old block did not fill
  109.                      * whole block. */
  110.     unsigned int writeZeroFills2;    /* Blocks that are zero filled because
  111.                      * user is only doing a partial write
  112.                      * to a new block. */
  113.     unsigned int partialWriteHits;    /* Read hits in the cache when are
  114.                      * writing to the middle of a block
  115.                      * and have to read in the data that
  116.                      * is already there. */
  117.     unsigned int partialWriteMisses;    /* Misses for above case. */
  118.     unsigned int blocksWrittenThru;    /* Number of dirty blocks that were
  119.                      * written thru. */
  120.     unsigned int dataBlocksWrittenThru;    /* Number of data block that were
  121.                      * written thru. */
  122.     unsigned int indBlocksWrittenThru;    /* Number of indirect blocks that
  123.                      * were written thru. */
  124.     unsigned int descBlocksWrittenThru;    /* Number of descriptor blocks that
  125.                      * were written thru. */
  126.     unsigned int dirBlocksWrittenThru;    /* Number of directory blocks that
  127.                      * were writtenw thru. */
  128.     /*
  129.      * Fragment statistics.
  130.      */
  131.     unsigned int fragAccesses;        /* Cache blocks that were fetched in
  132.                      * order to upgrade fragments. */
  133.     unsigned int fragHits;        /* Hits on fragAccesses. */
  134.     unsigned int fragZeroFills;        /* Cache blocks that had to be zero
  135.                      * filled because of frag upgrades. */
  136.     /*
  137.      * File descriptor accesses.
  138.      */
  139.     unsigned int fileDescReads;        /* File descriptor reads. */
  140.     unsigned int fileDescReadHits;    /* File descriptor hits in the cache. */
  141.     unsigned int fileDescWrites;    /* File descriptor writes. */
  142.     unsigned int fileDescWriteHits;    /* File descriptor write hits in the
  143.                      * cache. */
  144.     /*
  145.      * Indirect block accesses.
  146.      */
  147.     unsigned int indBlockAccesses;    /* Indirect block reads. */
  148.     unsigned int indBlockHits;        /* Access hits in the cache. */
  149.     unsigned int indBlockWrites;    /* Indirect blocks written. */
  150.     /*
  151.      * Directory block accesses.
  152.      */
  153.     unsigned int dirBlockAccesses;    /* Directory block reads. */
  154.     unsigned int dirBlockHits;        /* Directory block hits. */
  155.     unsigned int dirBlockWrites;    /* Directory block writes. */
  156.     unsigned int dirBytesRead;        /* Bytes read from directories */
  157.     unsigned int dirBytesWritten;    /* Bytes written to directories */
  158.     /*
  159.      * Variable size cache statistics.
  160.      */
  161.     unsigned int vmRequests;        /* Number of times virtual memory
  162.                      * requested memory from us. */
  163.     unsigned int triedToGiveToVM;    /* Number of vmRequests that we
  164.                      * tried to satisfy because
  165.                      * we had free blocks */
  166.     unsigned int vmGotPage;        /* Number of vmRequests that we
  167.                      * satisfied after checking LRU times */
  168.     /*
  169.      * Block allocation statistics.
  170.      */
  171.     unsigned int partFree;        /* Got the block off of the partially
  172.                      * free list. */
  173.     unsigned int totFree;        /* Got the block off of the totally
  174.                      * free list. */
  175.     unsigned int unmapped;        /* Created a new block. */
  176.     unsigned int lru;                /* Recycled a block. */
  177.     /*
  178.      * Cache size numbers.  These are monitored data, not counters--don't
  179.      * reset them.
  180.      */
  181.     unsigned int minCacheBlocks;    /* The minimum number of blocks that
  182.                       * can be in the cache. */
  183.     unsigned int maxCacheBlocks;    /* The maximum number of blocks that
  184.                       * can be in the cache. */
  185.     unsigned int maxNumBlocks;        /* The maximum number of blocks that
  186.                      * can ever be in the cache. */
  187.     unsigned int numCacheBlocks;    /* The actual number of blocks that
  188.                      * are in the cache. */
  189.     unsigned int numFreeBlocks;        /* The number of cache blocks that
  190.                      * aren't being used. */
  191.     /*
  192.      * Miscellaneous.
  193.      */
  194.     unsigned int blocksPitched;        /* The number of blocks that were
  195.                      * thrown out at the command of
  196.                      * virtual memory. */
  197.     int blocksFlushed;            /* The number of blocks written back
  198.                        due to consistency. */
  199.     int migBlocksFlushed;        /* The number of blocks written back
  200.                        due to consistency for migrated
  201.                        files. */
  202. } Fs_BlockCacheStats;
  203.  
  204. /*
  205.  * Block allocation statistics.
  206.  */
  207. typedef struct Fs_AllocStats {
  208.     unsigned int blocksAllocated;    /* Full blocks allocated. */
  209.     unsigned int blocksFreed;        /* Full blocks freed. */
  210.     unsigned int cylsSearched;        /* Cylinders searched to find a good
  211.                      * cylinder.*/
  212.     unsigned int cylHashes;        /* Hashes done to find a starting
  213.                      * cylinder. */
  214.     unsigned int cylBitmapSearches;    /* Cylinder bitmap entries searched. */
  215.     unsigned int fragsAllocated;    /* Fragments allocated. */
  216.     unsigned int fragsFreed;        /* Fragments freed. */
  217.     unsigned int fragToBlock;        /* Fragments that when freed made a
  218.                      * full block free. */
  219.     unsigned int fragUpgrades;        /* Fragments that were attempted to
  220.                      * be extended.*/
  221.     unsigned int fragsUpgraded;        /* Number of fragUpgrades that
  222.                      * were successful. */
  223.     unsigned int badFragList;        /* Fragment list entries that didn't
  224.                      * really have fragments of the
  225.                      * desired size.*/
  226.     unsigned int fullBlockFrags;    /* Full blocks that had to
  227.                      * be fragmented. */
  228. } Fs_AllocStats;
  229.  
  230. /*
  231.  * Name cache statistics.
  232.  */
  233. typedef struct Fs_NameCacheStats {
  234.     unsigned int accesses;        /* Number of times something was
  235.                      * looked for */
  236.     unsigned int hits;            /* Number of times it was found */
  237.     unsigned int replacements;        /* Number of entries recycled via LRU */
  238.     unsigned int size;            /* Number of entries total */
  239. } Fs_NameCacheStats;
  240.  
  241. /*
  242.  * Handle statistics.
  243.  */
  244. typedef struct Fs_HandleStats {
  245.     unsigned int maxNumber;    /* Current limit on table size. */
  246.     unsigned int exists;    /* Number of handles currently in existence. */
  247.     unsigned int installCalls;    /* Calls to Fsutil_HandleInstall. */
  248.     unsigned int installHits;    /* installs in which handle was found. */
  249.     unsigned int fetchCalls;    /* Calls to Fsutil_HandleFetch. */
  250.     unsigned int fetchHits;    /* fetches in which handle was found. */
  251.     unsigned int release;    /* Calls to Fsutil_HandleRelease. */
  252.     unsigned int locks;        /* Number of times a handle was locked. */
  253.     unsigned int lockWaits;    /* Number of times had to wait on a lock */
  254.     unsigned int unlocks;    /* Number of times a handle was unlocked. */
  255.     unsigned int created;    /* Handles that have been created. */
  256.     unsigned int lruScans;    /* Number of LRU replacement scans */
  257.     unsigned int lruChecks;    /* Number of handles checked for reclaimation */
  258.     unsigned int lruHits;    /* Number of handles actually reclaimed */
  259.     unsigned int lruEntries;    /* Number of handles in LRU list. */
  260.     unsigned int limbo;        /* Number of handles marked for removal */
  261.     /*
  262.      * The following are specific to regular files.
  263.      */
  264.     unsigned int versionMismatch; /* Version mismatch on file. */
  265.     unsigned int cacheFlushes;    /* Cache flushed because of version mismatch
  266.                  * of not cacheable. */
  267.     unsigned int segmentFetches; /* Calls by VM to see if there is indeed
  268.                   * already a segment with the code file. */
  269.     unsigned int segmentHits;    /* Segment fetches that return non-nil
  270.                  * segment. */
  271. } Fs_HandleStats;
  272.  
  273. /*
  274.  * Prefix table statistics.  These are client-side statistics
  275.  */
  276. typedef struct Fs_PrefixStats {
  277.     unsigned int relative;    /* Number of relative names encountered */
  278.     unsigned int absolute;    /* Number of absolute names subject to prefix
  279.                  * lookup */
  280.     unsigned int redirects;    /* Number of redirects from the server */
  281.     unsigned int loops;        /* Number of circular redirects */
  282.     unsigned int timeouts;    /* Number of times the server was down */
  283.     unsigned int stale;        /* Number of times server server rejected a
  284.                  * handle */
  285.     unsigned int found;        /* Number of times found a new prefix */
  286. } Fs_PrefixStats;
  287.  
  288. /*
  289.  * Name lookup statistics.  These are server-side statistics.
  290.  */
  291. typedef struct Fs_LookupStats {
  292.     unsigned int number;    /* Number of pathname lookups */
  293.     unsigned int numComponents;    /* Number of pathname components parsed */
  294.     unsigned int numSpecial;    /* Number of $MACHINE names encounted */
  295.     unsigned int forDelete;    /* Number for deletion */
  296.     unsigned int forLink;    /* Number for linking */
  297.     unsigned int forRename;    /* Number for rename */
  298.     unsigned int forCreate;    /* Number for creation */
  299.     unsigned int symlinks;    /* Number of symbolic links encountered */
  300.     unsigned int redirect;    /* Number of redirects due to symbolic links */
  301.     unsigned int remote;    /* Number of redirects due to remote links */
  302.     unsigned int parent;    /* Number of redirects due to ".." */
  303.     unsigned int notFound;    /* Number of FILE_NOT_FOUND lookups */
  304. } Fs_LookupStats;
  305.  
  306. /*
  307.  * Counts of various file system objects.
  308.  */
  309. typedef struct Fs_ObjectStats {
  310.     int streams;
  311.     int streamClients;        /* Equal to streams, except during migration */
  312.     int files;            /* Local files, not including directories */
  313.     int rmtFiles;
  314.     int pipes;
  315.     int devices;
  316.     int controls;        /* Pdev and Pfs control streams */
  317.     int pseudoStreams;        /* One count for both client/server handles */
  318.     int remote;            /* All the various remote objects but files*/
  319.     int directory;
  320.     int dirFlushed;        /* Directories that were flushed */
  321.     int fileClients;        /* Number of consist.clientList entries */
  322.     int other;            /* For unknown objects */
  323. } Fs_ObjectStats;
  324.  
  325. /*
  326.  * File system recovery statistics.
  327.  */
  328. typedef struct Fs_RecoveryStats {
  329.     int number;            /* Number of reopens by this client */
  330.     int wants;            /* Calls to Fsutil_WantRecovery */
  331.     int waitOK;            /* Successful RecoveryWaits */
  332.     int waitFailed;        /* Unnsuccessful RecoveryWaits */
  333.     int waitAbort;        /* Interrupted RecoveryWaits */
  334.     int timeout;        /* Re-open's that timed out */
  335.     int failed;            /* Re-open's that failed */
  336.     int deleted;        /* Re-open's of a file that has been deleted */
  337.     int offline;        /* Re-open's of a file that is now offline */
  338.     int succeeded;        /* Re-open's that worked */
  339.     int clientCrashed;        /* Number of clients that crashed */
  340.     int clientRecovered;    /* Number of clients that re-opened files */
  341.     int    reopensAvoided;        /* Unneeded reopens skipped */
  342. } Fs_RecoveryStats;
  343.  
  344. /*
  345.  * Cache conistency statistics.
  346.  */
  347. typedef struct Fs_ConsistStats {
  348.     int files;            /* The number of times consistency was checked*/
  349.     int clients;        /* The number of clients considered */
  350.     int notCaching;        /* # of other clients that weren't caching */
  351.     int readCachingMyself;    /* # of clients that were read caching */
  352.     int readCachingOther;    /* # of other clients that were read caching */
  353.     int writeCaching;        /* # of lastWriters that re-opened  */
  354.     int writeBack;        /* # of lastWriters forced to write-back */
  355.     int readInvalidate;        /* # of readers forced to stop caching */
  356.     int writeInvalidate;    /* # of writers forced to stop caching */
  357.     int nonFiles;        /* # of directories, links, etc. */
  358.     int swap;            /* # of uncached swap files. */
  359.     int cacheable;        /* # of files that were cacheable */
  360.     int uncacheable;        /* # of files that were not cacheable */
  361. } Fs_ConsistStats;
  362.  
  363. /*
  364.  * (More) Write-back statistics.
  365.  */
  366. typedef struct Fs_WriteBackStats {
  367.     int passes;            /* Number of times Fs_CleanBlocks called */
  368.     int files;            /* Number of dirty files processed */
  369.     int blocks;            /* Number of dirty blocks processed */
  370.     int maxBlocks;        /* Max blocks processed in one pass */
  371. } Fs_WriteBackStats;
  372.  
  373. /*
  374.  * Some miscellaneous stats to determine why we read remote bytes.
  375.  */
  376. typedef struct Fs_RemoteIOStats {
  377.     int blocksReadForVM;    /* Blocks read from Fs_PageRead (old) */
  378.     int bytesReadForCache;    /* Bytes read into the cache for remote files */
  379.     int bytesWrittenFromCache;    /* Bytes written from the cache for rmt files */
  380.     int uncacheableBytesRead;    /* Uncacheable bytes read (not counting swap) *
  381.                     * (FS_NOT_CACHEABLE flag) */
  382.     int uncacheableBytesWritten;/* Uncacheable bytes written *
  383.                     * (FS_NOT_CACHEABLE flag) */
  384.     int sharedStreamBytesRead;    /* Bytes read from shared uncacheable streams */
  385.     int sharedStreamBytesWritten;/* Bytes written to shared uncached streams */
  386.     int hitsOnVMBlock;        /* Code and Heap pages found in the cache */
  387.     int missesOnVMBlock;    /* Code and Heap pages not found in the cache */
  388.     int bytesReadForVM;        /* Bytes read in RmtFilePageRead */
  389.     int bytesWrittenForVM;    /* Bytes written in RmtFilePageWrite */
  390.     int    hitsOnHeapBlock;    /* Block in cache? */
  391.     int    missesOnHeapBlock;    /* Block not in cache? */
  392.     int    bytesReadForHeap;        /* Heap bytes read into cache */
  393.     int    bytesReadForHeapUncached;    /* Unached heap bytes read */
  394. } Fs_RemoteIOStats;
  395.  
  396. /*
  397.  * Statistics relating to migration.
  398.  */
  399. typedef struct Fs_MigStats {
  400.     unsigned int filesEncapsulated;     /* Total number of files encapsulated
  401.                        by this host */
  402.     unsigned int filesDeencapsulated;     /* Total number of files deencapsulated
  403.                        by this host */
  404.     unsigned int consistActions;     /* Total number of files for which
  405.                        this host was the i/o server doing
  406.                        consistency */
  407.     unsigned int readOnlyFiles;     /* Total number of files deencapsulated
  408.                        read-only */
  409.     unsigned int alreadyThere;         /* Total number of (writable) files
  410.                        already on target. NOT USED. */
  411.     unsigned int uncacheableFiles;     /* Total number of files deencapsulated
  412.                        that were uncacheable to begin
  413.                        with, and stayed that way. */
  414.     unsigned int cacheWritableFiles;     /* Total number of cacheable, writable
  415.                        files that were still cacheable
  416.                        after migration. */
  417.     unsigned int uncacheToCacheFiles;     /* Total number of uncacheable
  418.                        files that became cacheable after
  419.                        migration. */
  420.     unsigned int cacheToUncacheFiles;     /* Total number of cacheable
  421.                        files that became uncacheable after
  422.                        migration. */
  423.     unsigned int errorsOnDeencap;    /* Any files that couldn't be
  424.                        deencapsulated due to errors. */
  425.     unsigned int encapSquared;         /* Sum of squares for
  426.                        filesEncapsulated. */
  427.     unsigned int deencapSquared;     /* Sum of squares for
  428.                        filesDeencapsulated. */
  429. } Fs_MigStats;
  430.  
  431. /*
  432.  * File system statistics.  If you change this struct, be sure to verify 
  433.  * that ZeroFsStats is still okay.
  434.  */
  435. #define FS_STAT_VERSION 2
  436. typedef struct Fs_Stats {
  437.     int            statsVersion;   /* Version number of statistics info */
  438.     Fs_NameOpStats    cltName;    /* Client-side naming operations */
  439.     Fs_NameOpStats    srvName;    /* Server-side naming operations */
  440.     Fs_GeneralStats    gen;        /* General I/O operations */
  441.     Fs_BlockCacheStats    blockCache;    /* Block cache operations */
  442.     Fs_AllocStats    alloc;        /* Disk allocation */
  443.     Fs_HandleStats    handle;        /* Handle management */
  444.     Fs_PrefixStats    prefix;        /* Client-side prefix operations */
  445.     Fs_LookupStats    lookup;        /* Server-side lookup operations */
  446.     Fs_NameCacheStats    nameCache;    /* Server name cache */
  447.     Fs_ObjectStats    object;        /* Counts of various objects */
  448.     Fs_RecoveryStats    recovery;    /* Crash recovery and reopening */
  449.     Fs_ConsistStats    consist;    /* Cache consistency actions */
  450.     Fs_WriteBackStats    writeBack;    /* Cache write-back stats */
  451.     Fs_RemoteIOStats    rmtIO;        /* Remote I/O stats */
  452.     Fs_MigStats        mig;        /* Migration */
  453. } Fs_Stats;
  454.  
  455. /*
  456.  * Keep a histogram of file lifetimes in a three-dimensional matrix,
  457.  * for lifetime, file size, and file type.  Buckets for size are
  458.  * scaled logarithmically.  Buckets for lifetime are determined as
  459.  * follows, where each bucket corresponds to a lifetime less than that
  460.  * value:
  461.  *
  462.  *    seconds: 1, 2, ..., 10, 20, ..., 50
  463.  *    minutes: 1, 2, ..., 10, 20, ..., 50
  464.  *      hours:   1, 2, ..., 10, 15, 20 (<24)
  465.  *    days:    1, 2, ..., 10, 20, .., 60, 90, 120, 180, 240, 300, 360, > 360
  466.  *
  467.  * For example, a file that is 0 seconds old is < 1 second and is in
  468.  * bucket 0; a file that is exactly 15 hours old is in the bucket labeled
  469.  * "20 hours" since that contains everything from 15 hours to
  470.  * (20 hours - 1 second).
  471.  *
  472.  * The divisions are somewhat arbitrary and are subject to change.
  473.  * Define the number of buckets here: 32 size buckets will cover 2 **
  474.  * 32 bytes (max file size); throw in one more bucket for subtotals by
  475.  * time.  For times, define an array containing the number of seconds
  476.  * and number of buckets for each group described above.
  477.  */
  478. #define FS_HIST_SIZE_BUCKETS     33
  479.  
  480. typedef struct Fs_HistGroupInfo {
  481.     unsigned int secondsPerBucket;
  482.     unsigned int bucketsPerGroup;
  483. } Fs_HistGroupInfo;
  484.  
  485.  
  486. #define FS_HIST_SECONDS        10
  487. #define FS_HIST_TEN_SECONDS    5
  488. #define FS_HIST_MINUTES        9
  489. #define FS_HIST_TEN_MINUTES    5
  490. #define FS_HIST_HOURS        9
  491. #define FS_HIST_FIVE_HOURS    2
  492. #define FS_HIST_REST_HOURS    1
  493. #define FS_HIST_DAYS        9
  494. #define FS_HIST_TEN_DAYS     5
  495. #define FS_HIST_THIRTY_DAYS     2
  496. #define FS_HIST_SIXTY_DAYS     4
  497. #define FS_HIST_REST_DAYS     1
  498.  
  499. #define FS_HIST_TIME_BUCKETS (FS_HIST_SECONDS + \
  500.                   FS_HIST_TEN_SECONDS + \
  501.                   FS_HIST_MINUTES + \
  502.                   FS_HIST_TEN_MINUTES + \
  503.                   FS_HIST_HOURS + \
  504.                   FS_HIST_FIVE_HOURS + \
  505.                   FS_HIST_REST_HOURS + \
  506.                   FS_HIST_DAYS + \
  507.                   FS_HIST_TEN_DAYS + \
  508.                   FS_HIST_THIRTY_DAYS + \
  509.                   FS_HIST_SIXTY_DAYS + \
  510.                   FS_HIST_REST_DAYS)
  511.  
  512. /*
  513.  * The number of types that we gather statistics for.
  514.  */
  515. #define FS_STAT_NUM_TYPES 5
  516.  
  517. /*
  518.  * Subscripts for arrays that separate data for read and write.
  519.  */
  520. #define FS_STAT_READ 0
  521. #define FS_STAT_WRITE 1
  522.  
  523. typedef struct Fs_TypeStats {
  524.     unsigned int diskBytes[2][FS_STAT_NUM_TYPES];
  525.                     /* Number of bytes read/written from/to
  526.                  * different types of files on disk */
  527.     unsigned int cacheBytes[2][FS_STAT_NUM_TYPES];
  528.                     /* Number of bytes read or written through
  529.                  * cache */
  530.     unsigned int bytesDeleted[FS_STAT_NUM_TYPES];
  531.                     /* Number of bytes deleted from files due
  532.                  * to truncation or removal */
  533.     unsigned int deleteHist    /* Histogram of deletions, by type */
  534.         [FS_HIST_TIME_BUCKETS] [FS_HIST_SIZE_BUCKETS] [FS_STAT_NUM_TYPES];
  535. } Fs_TypeStats;
  536.  
  537. Fs_TypeStats fs_TypeStats;
  538.  
  539. /*
  540.  * Macro to add to a counter, watching for overflow.  We use unsigned
  541.  * integers and wrap around if the high-order bit gets set.  This assumes
  542.  * that the amount to be added each time is
  543.  * relatively small (so we can't miss the overflow bit).
  544.  */
  545.  
  546. #define FS_STAT_OVERFLOW (1 << (sizeof(unsigned int) * 8 - 1))
  547. #define Fs_StatAdd(thisCount, counter, overflow) \
  548.     counter += thisCount; \
  549.     if (counter & FS_STAT_OVERFLOW) { \
  550.         overflow += 1; \
  551.         counter &= ~FS_STAT_OVERFLOW; \
  552.     }
  553.  
  554. #ifdef SOSP91
  555. typedef    struct    Fs_SospMigStats {
  556.     Fs_BlockCacheStats    blockCache;
  557.     Fs_RemoteIOStats    rmtIO;
  558.     Fs_GeneralStats    gen;
  559. } Fs_SospMigStats;
  560.     
  561.  
  562. extern    Fs_SospMigStats    fs_SospMigStats;
  563. #endif SOSP91
  564.  
  565. /*
  566.  * We've changed things so that heap pages are cacheable.
  567.  * In order to know how much of the vm bytes are found in the cache or not,
  568.  * we need these new counters.  bytesReadForCache now includes heap bytes
  569.  * as does bytesReadForVM, so we use this extra counter to know how much of
  570.  * that is so.
  571.  */
  572. #ifdef SOSP91
  573. typedef    struct Fs_NewStats {
  574.     int        uncacheableDirBytesRead;
  575.     int        uncacheableDirBytesReadMig;
  576.     int        CORPageServerRead;
  577.     int        CORPageServerReadM;
  578.     int        hitsOnCodePage;
  579.     int        hitsOnCodePageM;
  580.     int        hitsOnSwapPage;
  581.     int        hitsOnSwapPageM;
  582.     int        missesOnCodePage;
  583.     int        missesOnCodePageM;
  584.     int        missesOnSwapPage;
  585.     int        missesOnSwapPageM;
  586.     int        psFilledM;
  587.     int        fsFilledM;
  588.     int        zeroFilledM;
  589.     int        totalFaultsM;
  590.     int        remoteDevicishBytesRead;
  591.     int        remoteDevicishBytesReadM;
  592.     int        COWCopySwapPage;
  593.     int        COWCopySwapPageM;
  594. } Fs_NewStats;
  595. extern    Fs_NewStats    fs_MoreStats;
  596. #endif SOSP91
  597.  
  598. extern    Fs_Stats    fs_Stats;
  599.  
  600. #endif _FSSTAT
  601.